﻿<?
//xna
DEFINE("_ROOT",".");
include  _ROOT."/mainfile.php";
include _ROOT."/class/functions.php";
$cate = is_numeric( $_GET[cate] )  ? $_GET[cate] : "";
if(!in_array($cate,array_keys($rss_cate))) $cate="";
$arg = $cate>"" ? " and x.rss_cate='$cate' " : "";
$xnadb = $PlusDB->prefix("xna");
$xnanewsdb = $PlusDB->prefix("xna_news");
$cate_ids = implode(",",array_keys($rss_cate));
$sql="select count(*) as sum ,rss_cate from $xnadb where rss_cate in ($cate_ids) group by rss_cate ";
$rt = $PlusDB->execute($sql);
while($crow = $rt->fetchRow()){
	$cates[$crow[rss_cate]][id]=$crow[rss_cate];
	$cates[$crow[rss_cate]][name]=$rss_cate[$crow[rss_cate]];
	$cates[$crow[rss_cate]][sum]=$crow[sum];
}

$num = $PlusDB->getone($sql);
$start = ($start>$num)?0:$start;

$sql="select * from $xnadb order by ctime desc ";
$rt = $PlusDB->execute($sql);
while($row = $rt->fetchRow()){
$row["rss_cate"] = $rss_cate[$row["rss_cate"]];
$row[sum] = $xnum[$row[id]];
$ret[]=$row;
}
$smarty->assign("list",$ret);
$smarty->assign("rss_cate",$cates);
$smarty->display("template/default/site.tpl");
?>